package com.itcast.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface RedisMapper {

    @Select("select stock from stock where id = #{shopId}")
    Integer queryStock(Integer shopId);

    @Update("update stock set stock=stock-1 where id = #{shopId} and stock > 0")
    void updateStock(Integer shopId);
}
